﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;

namespace CDFWPUG.Model
{
    public class UserApp : INotifyPropertyChanged

    {
        public string ID { get; set; }
        public string Name { get; set; }
        public string Description{ get; set; }
        public string ApplicationID { get; set; }
        public string UserName { get; set; }
        public string ImageUrl { get; set; }
        public string Price { get; set; }


        public event PropertyChangedEventHandler PropertyChanged;
        protected void RaisePropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;

            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        private string _NameKey;
        /// <summary>
        /// First letter of the Name. Used for grouping in the long list selector
        /// </summary>
        public string NameKey
        {
            get
            {
                //If not set then
                if (_NameKey == null)
                {
                    //get the first letter of the Name
                    char key = char.ToLower(this.Name[0]);
                    if (key < 'a' || key > 'z')
                    {
                        key = '#';
                    }
                    _NameKey = key.ToString();
                }
                return _NameKey;
            }
        }

    }
}
